﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RO___Simulasi_Boarding
{
    public partial class mainForm : Form
    {
        string programName;
        int okupansi;
        int groups;
        Random rand;
        Bitmap img_chair, img_kpala, img_badan, img_ekor;
        List<Passanger> passangers;
        Cell[][] cells;
        int row, column, betweenTime,time;
        bool isInputan;
        List<Point> emergencies;
        public mainForm()
        {
            InitializeComponent();
            img_chair = new Bitmap(Directory.GetCurrentDirectory() + "\\images\\kursi.png");
            img_badan = new Bitmap(Directory.GetCurrentDirectory() + "\\images\\pesawatRO-badan.png");
            img_ekor = new Bitmap(Directory.GetCurrentDirectory() + "\\images\\pesawatRO - ekor.png");
            img_kpala = new Bitmap(Directory.GetCurrentDirectory() + "\\images\\pesawatRO.png");
            rand = new Random();
        }

        private void mainForm_Load(object sender, EventArgs e)
        {
        }

        private void mainPanel_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawImage(img_badan, (mainPanel.Width - row * 35 + 5) / 2, -50 + (mainPanel.Height - column * 44 + 5) / 2, row*35, column * 44 + 100);
            e.Graphics.DrawImage(img_kpala, -220 + (mainPanel.Width - row * 35 + 5) / 2, -50 + (mainPanel.Height - column * 44 + 5) / 2, 222, column * 44 + 100);
            e.Graphics.DrawImage(img_ekor, -2 + row * 35 + (mainPanel.Width - row * 35 + 5) / 2, -50 + (mainPanel.Height - column * 44 + 5) / 2, 180, column * 44 + 100);
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < column; j++)
                {
                    cells[i][j].gambar(e.Graphics);
                    for (int k = cells[i][j].TempPassangers.Count - 1; k >= 0; k--)
                    {
                        cells[i][j].TempPassangers[k].gambar(e.Graphics, -5*(k+1) + (mainPanel.Width - row * 35 + 5) / 2,
                        (mainPanel.Height - column * 35 + 5) / 2);
                    }
                    if (i == 0) e.Graphics.DrawString(decodePosition(j).ToString(), new Font("Arial", 15, FontStyle.Bold), Brushes.Black, -30 + (mainPanel.Width - row * 35 + 5) / 2, 5 + (mainPanel.Height - column * 35 + 5) / 2 + 35*j);
                }
                if (i > 0) e.Graphics.DrawString(i.ToString(), new Font("Arial", 15, FontStyle.Bold), Brushes.Black, (mainPanel.Width - row * 35 + 5) / 2 + i * 35, (mainPanel.Height - column * 35 + 5) / 2 - 50 + 2*column);
            }
            for (int i = 0; i < passangers.Count; i++) 
                passangers[i].gambar(e.Graphics, (mainPanel.Width - row * 35 + 5) / 2,
                (mainPanel.Height - column * 35 + 5) / 2);

        }

        private void mainPanel_MouseClick(object sender, MouseEventArgs e)
        {
            mainPanel.Refresh();
        }

        private void bt_start_Click(object sender, EventArgs e)
        {
            if (bt_start.Text == "Ulangi")
            {
                bt_start.Text = "Mulai";
                initialize();
                acakMasuk();
                sortByGroup();
                lb_time.Text = time.ToString();
                mainPanel.Refresh();
                bt_start_Click(sender, e);
            }
            else if (mainTimer.Enabled == false)
            {
                mainTimer.Enabled = true;
                bt_start.Text = "Stop";
            }
            else
            {
                mainTimer.Enabled = false;
                bt_start.Text = "Mulai";
            }
        }

        private void mainTimer_Tick(object sender, EventArgs e)
        {
            jalan();
            if (passangers.Count() > 0 && passangers[0].getCoordinate().Y < column) time++;
            lb_time.Text = time.ToString();
            mainPanel.Refresh();
            if (isFinal())
            {
                mainTimer.Enabled = false;
                bt_start.Text = "Ulangi";
            }
        }
        private void jalan()
        {
            for (int i = 0; i < passangers.Count; i++)
            {
                if (passangers[i].DoorIn == 0)
                {
                    if (passangers[i].getCoordinate().Y <= column)
                    {
                        if (passangers[i].getCoordinate().X == 0 && passangers[i].getCoordinate().Y > column / 2)
                        {
                            pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                        }
                        else if (passangers[i].getCoordinate().Y == column / 2 && passangers[i].getCoordinate().X < passangers[i].getDestination().X)
                        {
                            pindah(i, new Point(passangers[i].getCoordinate().X + 1, passangers[i].getCoordinate().Y));
                        }
                        else if (passangers[i].getCoordinate().X == passangers[i].getDestination().X)
                        {
                            if (!passangers[i].StatusGeser)
                            {
                                if (passangers[i].Baggage > 0) passangers[i].baggaging();
                                else if (passangers[i].getCoordinate().Y == column / 2)
                                {
                                    if (bisaLewat(passangers[i]))
                                    {
                                        if (passangers[i].getCoordinate().Y < passangers[i].getDestination().Y)
                                            pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y + 1));
                                        else if (passangers[i].getCoordinate().Y > passangers[i].getDestination().Y)
                                            pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                                    }
                                    else
                                    {
                                        if (passangers[i].getCoordinate().Y > passangers[i].getDestination().Y)
                                            geser(passangers[i].getDestination(), true);
                                        else if (passangers[i].getCoordinate().Y < passangers[i].getDestination().Y)
                                            geser(passangers[i].getDestination(), false);
                                    }
                                }
                                else if (passangers[i].getCoordinate().Y < passangers[i].getDestination().Y)
                                    pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y + 1));
                                else if (passangers[i].getCoordinate().Y > passangers[i].getDestination().Y)
                                    pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                                else if (passangers[i].getCoordinate().Y == passangers[i].getDestination().Y) passangers[i].StatusGeser = true;
                            }
                        }
                    }
                    else if ((i > 0 && passangers[i - 1].getCoordinate().Y < column + 3 - betweenTime) || i == 0)
                        passangers[i].setCoordinate(new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                }
                else
                {
                    if (passangers[i].getCoordinate().Y <= column)
                    {
                        if (passangers[i].getCoordinate().Y > column / 2)
                        {
                            pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                        }
                        else if (passangers[i].getCoordinate().Y == column / 2 && passangers[i].getCoordinate().X > passangers[i].getDestination().X)
                        {
                            pindah(i, new Point(passangers[i].getCoordinate().X - 1, passangers[i].getCoordinate().Y));
                        }
                        else if (passangers[i].getCoordinate().X == passangers[i].getDestination().X)
                        {
                            if (!passangers[i].StatusGeser)
                            {
                                if (passangers[i].Baggage > 0) passangers[i].baggaging();
                                else if (passangers[i].getCoordinate().Y == column / 2)
                                {
                                    if (bisaLewat(passangers[i]))
                                    {
                                        if (passangers[i].getCoordinate().Y < passangers[i].getDestination().Y)
                                            pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y + 1));
                                        else if (passangers[i].getCoordinate().Y > passangers[i].getDestination().Y)
                                            pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                                    }
                                    else
                                    {
                                        if (passangers[i].getCoordinate().Y > passangers[i].getDestination().Y)
                                            geser(passangers[i].getDestination(), true);
                                        else if (passangers[i].getCoordinate().Y < passangers[i].getDestination().Y)
                                            geser(passangers[i].getDestination(), false);
                                    }
                                }
                                else if (passangers[i].getCoordinate().Y < passangers[i].getDestination().Y)
                                    pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y + 1));
                                else if (passangers[i].getCoordinate().Y > passangers[i].getDestination().Y)
                                    pindah(i, new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                                else if (passangers[i].getCoordinate().Y == passangers[i].getDestination().Y) passangers[i].StatusGeser = true;
                            }
                        }
                    }
                    else if ((i > 0 && passangers[i - 1].getCoordinate().Y < column + 3 - betweenTime) || i == 0)
                        passangers[i].setCoordinate(new Point(passangers[i].getCoordinate().X, passangers[i].getCoordinate().Y - 1));
                }

           }
                
        }
        public bool isFinal()
        {
            for (int i = 0; i < passangers.Count(); i++)
            {
                if (passangers[i].getCoordinate().X != passangers[i].getDestination().X
                    || passangers[i].getCoordinate().Y != passangers[i].getDestination().Y)
                    return false;
            }
            return true;
        }
        private void initialize()
        {
            lbl_subtitle.Text = "Pesawat dengan ukuran " + (row - 1).ToString() + " x " + (column - 1).ToString();
            bt_start.Text = "Mulai";
            mainTimer.Interval = 1000;
            lbl_title.Text = programName;
            time = 0;
            lb_time.Text = time.ToString();

            cells = new Cell[row][];
            for (int i = 0; i < row; i++) cells[i] = new Cell[column];
            int awal1 = (mainPanel.Width - row * 35 + 5) / 2;
            int awal2 = (mainPanel.Height - column * 35 + 5) / 2;

            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < column; j++)
                {
                    if (j == column / 2 || i == 0)
                        cells[i][j] = new Cell(new Point(awal1 + 35 * i, awal2 + 35 * j), 0, column);
                    else cells[i][j] = new Cell(new Point(awal1 + 35 * i, awal2 + 35 * j), 1, column);
                    cells[i][j].Image = img_chair;
                }
            }

            for (int i = 0; i < emergencies.Count; i++)
                cells[emergencies[i].X][emergencies[i].Y] = new Cell(new Point(awal1 + 35 * emergencies[i].X, 
                    awal2 + 35 * emergencies[i].Y), 0, column);

            for (int i = 0; i < passangers.Count(); i++)
                if (passangers[i].DoorIn == 0) passangers[i].resetTo(new Point(0, column + 3));
                else passangers[i].resetTo(new Point(row, column + 3));
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < column; j++)
                {
                    cells[i][j].Passanger = null;
                    cells[i][j].TempPassangers.Clear();
                }
            }
        }
        private void sortByGroup()
        {
            for (int i = 0; i < passangers.Count() -1; i++)
            {
                for (int j = i+1; j < passangers.Count(); j++)
                {
                    if (passangers[i].getGroup() >= passangers[j].getGroup())
                    {
                        Passanger pTemp = passangers[i];
                        passangers[i] = passangers[j];
                        passangers[j] = pTemp;
                    }
                }
            }
        }

        private void acakMasuk()
        {
            for (int i = 0; i < passangers.Count; i++)
            {
                int j = rand.Next(passangers.Count);
                if (i != j)
                {
                    Passanger pTemp = passangers[i];
                    passangers[i] = passangers[j];
                    passangers[j] = pTemp;
                }
            }
        }


        private void pindah(int noPsgr, Point dest)
        {
            if (dest.X >= 0 && dest.X < row && dest.Y >= 0 && dest.Y < column)
            {
                if (cells[dest.X][dest.Y].Passanger == null)
                {
                    int tempX = passangers[noPsgr].getCoordinate().X;
                    int tempY = passangers[noPsgr].getCoordinate().Y;
                    if (tempX >= 0 && tempX < row && tempY >= 0 && tempY < column)
                    {
                        if (cells[tempX][tempY].TempPassangers.Count > 0)
                        {
                            cells[tempX][tempY].Passanger = cells[tempX][tempY].TempPassangers[cells[tempX][tempY].TempPassangers.Count - 1];
                            cells[tempX][tempY].TempPassangers.RemoveAt(cells[tempX][tempY].TempPassangers.Count - 1);
                            cells[tempX][tempY].Passanger.StatusGeser = false;
                        }
                        else cells[tempX][tempY].Passanger = null;
                    }
                    passangers[noPsgr].setCoordinate(dest);
                    cells[dest.X][dest.Y].Passanger = passangers[noPsgr];
                }
            }
            else
            {
                this.Text = "Bah, error :(";
            }
        }

        string getWord(int index, string statement)
        {
            string res = "";
            int temp = index;
            if (index > 0)
            {
                int a=0;
                for(int i=0;i<=statement.Length;i++){
                    if (i < statement.Length && statement[i] == ' ')
                    {
                        temp--;
                        if (temp == 0)
                        {
                            res = statement.Substring(a, i - a);
                            break;
                        }
                        i++;
                        a = i;
                    }
                    else if (i == statement.Length)
                    {
                        if (temp == 1) res = statement.Substring(a, i - a);
                        else res = null;
                    }
                }
                return res;
            }
            else return null;
        }

        private bool bisaLewat(Passanger p)
        {
            int x = p.getDestination().X;
            int y = p.getDestination().Y;
            if(y > column/2){
                for(int i=(column/2)+1; i< y; i++)
                    if (cells[x][i].Passanger != null) return false;
                return true;
            }
            else if (y < column / 2)
            {
                for (int i = (column / 2) - 1; i > y; i--)
                    if (cells[x][i].Passanger != null) return false;
                return true;
            }
            return true;
        }

        private void geser(Point dest, bool right){
            if (right)
            {
                for(int i=(column/2)-1;i>dest.Y; i--){
                    Passanger pNow = cells[dest.X][i].Passanger;
                    if (pNow != null && pNow.StatusGeser == true)
                    {
                        if (cells[dest.X][i + 1].Passanger != null)
                        {
                            cells[dest.X][i + 1].TempPassangers.Add(pNow);
                        }
                        else
                        {
                            cells[dest.X][i + 1].Passanger = pNow;
                        }
                        pNow.setCoordinate(new Point(dest.X, i + 1));
                        cells[dest.X][i].Passanger = null;
                    }
                }
            }
            else
            {
                for (int i = (column / 2) + 1; i < dest.Y; i++)
                {
                    Passanger pNow = cells[dest.X][i].Passanger;
                    if (pNow != null && pNow.StatusGeser == true)
                    {
                        if (cells[dest.X][i - 1].Passanger != null)
                        {
                            cells[dest.X][i - 1].TempPassangers.Add(pNow);
                        }
                        else
                        {
                            cells[dest.X][i - 1].Passanger = pNow;
                        }
                        pNow.setCoordinate(new Point(dest.X, i - 1));
                        cells[dest.X][i].Passanger = null;
                    }
                }
            }
        }

        private void bt_akhiri_Click(object sender, EventArgs e)
        {
            mainTimer.Enabled = false;
            while (!isFinal())
            {
                jalan();
                if (passangers.Count() > 0 && passangers[0].getCoordinate().Y < column) time++;
            }
            mainPanel.Refresh();
            lb_time.Text = time.ToString();
            bt_start.Text = "Ulangi";
        }

        private bool bacaInput()
        {
            isInputan = true;
            OpenFileDialog ofd = new OpenFileDialog();
            bool isRandom = false;
            ofd.InitialDirectory= Directory.GetCurrentDirectory();
            ofd.Filter = "CANV files|*.canv|All files (*.*)|*.*";
            ofd.ShowDialog();
            if (ofd.FileName == "") return false;
            FileStream inputFile = new FileStream(ofd.FileName, FileMode.OpenOrCreate, FileAccess.Read);
            StreamReader reader = new StreamReader(inputFile);
            string myString = reader.ReadLine();
            if (myString.ToUpper() == "(CANV)")
            {
                try
                {
                    programName = reader.ReadLine();
                    myString = reader.ReadLine();
                    row = int.Parse(getWord(2, myString)) + 1;
                    column = int.Parse(getWord(4, myString)) + 1;
                    myString = reader.ReadLine();
                    betweenTime = int.Parse(getWord(2, myString));
                    myString = reader.ReadLine();
                    groups = int.Parse(getWord(2, myString));
                    myString = reader.ReadLine();
                    
                    int emergen = int.Parse(getWord(2, myString));
                    emergencies = new List<Point>();

                    for (int i = 0; i < emergen; i++)
                    {
                        myString = reader.ReadLine();
                        int emX = int.Parse(getWord(1, myString));
                        int emY = encodePosition(getWord(2, myString)[0]);
                        if (emY < 0 || emY >= column)
                        {
                            MessageBox.Show("Terdapat Kesalahan Pada Format Input");
                            reader.Close();
                            inputFile.Close();
                            return false;
                        }
                        emergencies.Add(new Point(emX, emY));
                    }

                    reader.ReadLine();
                    myString = reader.ReadLine();
                    int x, y, g, b;
                    passangers = new List<Passanger>();
                    while (myString != null)
                    {
                        x = int.Parse(getWord(1, myString));
                        y = encodePosition(getWord(2, myString)[0]);
                        if (y < 0 || y >= column)
                        {
                            MessageBox.Show("Terdapat Kesalahan Pada Format Input");
                            reader.Close();
                            inputFile.Close();
                            return false;
                        }
                        g = int.Parse(getWord(3, myString));
                        if (getWord(4, myString) != null)
                            b = int.Parse(getWord(4, myString));
                        else
                        {
                            if (isRandom == false)
                            {
                                MessageBox.Show("Jumlah bagasi belum ditentukan.\nBagasi tiap penumpang akan dirandom antara 0 - 3");
                                isRandom = true;
                            }
                            b = rand.Next(4);
                        }
                        //passangers.Add(new Passanger(new Point(0, column + 3), new Point(x, y), g, (x.ToString() + decodePosition(y).ToString()), b));
                        myString = reader.ReadLine();
                    }
                    acakMasuk();
                    sortByGroup();
                }
                catch 
                {
                    return false;
                }
            }
            else
            {
                MessageBox.Show("Input Tidak Valid");
                reader.Close();
                inputFile.Close();
                return false;
            }
            initialize();
            inputFile.Close();
            return true;
        }

        private void btn_back_Click(object sender, EventArgs e)
        {
            mainTimer.Enabled = false;
            if (isInputan)
            {
                panel_welcome.Visible = true;
                return;
            }
            if (bt_start.Text == "Stop") bt_start.Text = "Mulai";
            DialogResult dr = MessageBox.Show("Simpan Konfigurasi?", "Simpan", MessageBoxButtons.YesNoCancel);
            if (dr == DialogResult.Yes)
            {
                if (saveFile())
                    panel_welcome.Visible = true;
            }
            else if (dr == DialogResult.No)
            {
                panel_welcome.Visible = true;
            }
        }

        private void btn_new_Click(object sender, EventArgs e)
        {
            isInputan = false;
            ParamForm param = new ParamForm();
            if (param.ShowDialog() != DialogResult.OK) return;
            row = param.row + 1;
            column = param.column + 1;
            programName = param.progName;
            betweenTime = param.betweenTime;
            groups = param.group;
            okupansi = param.occupancy;
            emergencies = new List<Point>();

            passangers = new List<Passanger>();
            int[] arrKosong;
            int size = (int) ((((row - 1) * (column - 1) - emergencies.Count) * ((float)(100 - okupansi)))/100);
            arrKosong = new int[size];

            for (int i = 0; i < size; i++)
            {
                arrKosong[i] = rand.Next((row - 1) * (column - 1));
                for (int j = 0; j < i; j++)
                {
                    if (arrKosong[i] == arrKosong[j])
                    {
                        i--;
                        break;
                    }
                }
            }

            for (int i = 0; i < size - 1; i++)
            {
                for (int j = i+1; j < size; j++)
                {
                    if (arrKosong[i] > arrKosong[j])
                    {
                        int temp = arrKosong[i];
                        arrKosong[i] = arrKosong[j];
                        arrKosong[j] = temp;
                    }
                }
            }

            int indEmp = 0, x=1, y=0;
            for (int i = 0; i < (row - 1) * (column - 1); i++)
            {
                if (indEmp < size && i == arrKosong[indEmp]) indEmp++;
                else
                {
                    if (x <= row / 2) passangers.Add(new Passanger(new Point(0, column + 3), new Point(x, y), rand.Next(groups) + 1, (x.ToString() + decodePosition(y).ToString()), rand.Next(4), 0));
                    else passangers.Add(new Passanger(new Point(row, column + 3), new Point(x, y), rand.Next(groups) + 1, (x.ToString() + decodePosition(y).ToString()), rand.Next(4), 1));
                }
                y++;
                if (y == column / 2) y++;
                if (y == column) { y = 0; x++; }
            }
            initialize();
            acakMasuk();
            sortByGroup();
            panel_welcome.Visible = false;
        }

        private void btn_input_Click(object sender, EventArgs e)
        {
            if (bacaInput())
            {
                initialize();
                panel_welcome.Visible = false;
            }
        }

        private void btn_close_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void bt_percepat_Click(object sender, EventArgs e)
        {
            if(mainTimer.Interval > 10)
                mainTimer.Interval /= 2;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (mainTimer.Interval < 5000)
                mainTimer.Interval *= 2;
        }

        private bool saveFile()
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.FileName = programName + ".canv";
            sfd.Filter = "CANV files|*.canv|All files (*.*)|*.*";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                if (sfd.FileName != "" && sfd.FileName != null)
                {
                    FileStream thisFile = new FileStream(sfd.FileName, FileMode.OpenOrCreate, FileAccess.Write);
                    StreamWriter writer = new StreamWriter(thisFile);
                    writer.WriteLine("(CANV)");
                    writer.WriteLine(programName);
                    writer.WriteLine("UKURAN " + (row - 1).ToString() + " x " + (column - 1).ToString());
                    writer.WriteLine("WAKTUANTARA " + betweenTime.ToString());
                    writer.WriteLine("GRUP " + groups.ToString());
                    writer.WriteLine("EMERGENCYEXIT " + emergencies.Count.ToString());
                    for (int i = 0; i < emergencies.Count; i++)
                        writer.WriteLine(emergencies[i].X.ToString() + " " + emergencies[i].Y.ToString());
                    writer.WriteLine("KONFIGURASI PENUMPANG (BARISTUJUAN KOLOMTUJUAN GRUP BAGASI) :");
                    for (int i = 0; i < passangers.Count; i++)
                    {
                        int x = passangers[i].getDestination().X;
                        int y = passangers[i].getDestination().Y;      
                        writer.WriteLine(x + " " + decodePosition(y).ToString() + " " + passangers[i].getGroup() + " " + passangers[i].FirstBaggage);
                    }
                    writer.Flush();
                    writer.Close();
                    thisFile.Close();
                    return true;
                }
            }
            return false;
        }

        private char decodePosition(int itsColumn)
        {
            char c = '\0';
            if (itsColumn == column - 1) c = 'A';
            else if (itsColumn == 0) c = 'F';
            else if (itsColumn == column / 2 + 1) c = 'C';
            else if (itsColumn == column / 2 - 1) c = 'D';
            else if (itsColumn < column / 2 - 1) c = 'E';
            else if (itsColumn > column / 2 + 1) c = 'B';
            return c;
        }

        private int encodePosition(char itsColumn)
        {
            if(itsColumn == 'A' || itsColumn == 'a') return column - 1;
            if(itsColumn == 'B' || itsColumn == 'b') return column - 2;
            if(itsColumn == 'C' || itsColumn == 'c') return column/2 + 1;
            if(itsColumn == 'D' || itsColumn == 'd') return column/2 - 1;
            if(itsColumn == 'E' || itsColumn == 'e') return 1;
            if (itsColumn == 'F' || itsColumn == 'f') return 0;
            return -1;
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void panel_welcome_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}